import { mapGetters } from 'vuex';
// 增加全局过滤方法
import filters from '@/utils/filter';
// moment
import moment from 'moment';
// mitt
import mitt from 'mitt';


import { getPdf } from '@/utils/helper/htmlToPDF';

// 自定义全局属性
const customProperty = {
    filters,
    moment,
    mitt: mitt(),
    getPdf
};
declare module '@vue/runtime-core' {
    interface ComponentCustomProperties {
        $store: any,
        $moment: any,
        $filters: any,
        $mitt: any,
        $refs: any,
        userInfo: any,
        dicOptions: any,
        $getPdf: any
    }
}
export default (app): void => {
    // 挂载全局属性
    Object.keys(customProperty).forEach((key) => {
        app.config.globalProperties[`$${key}`] = customProperty[key];
    });
    // 挂载vuex中的用户属性
    app.mixin({
        computed: {
            ...mapGetters(['userInfo', 'dicOptions'])
        }
    });
};